home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
T-TPUG Old Monthly Disks
/
(c)tv.d64
/
ratrun.c
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
7KB
|
267 lines
100 POKE53272,21
110 PRINT"[147]";TAB(15);"RATRUN"
120 FORI=1TO10:PRINT"[192][192][192][192]";:NEXT
130 PRINT"FIND YOUR WAY THROUGH A PERSPECTIVE MAZE
140 [153]"YOUR CONTROLS FOR JOYSTICK TWOWAIT ARE:
150 PRINT" UP MOVE FORWARD
160 [153]" LEFT TURN LEFT
170 PRINT" RIGHT TURN RIGHT
180 [153]" DOWN TURN AROUND
190 PRINT" BUTTON HELP!
200 [153]"PRESS BUTTONWAIT TO BEGIN
210 I=((PEEK(56320)AND16)=0):IFI=0THEN210
220 PRINT"[147]":CR$=CHR$(13):QK=198
225 ML=(PEEK(45)+256*PEEK(46)-512)
230 H=12:V=7:H1=H+1:W=ML:V1=ML+256
240 DIMXL(4),N2(4),YL(4),XR(4)
250 FORI=0TO4:READXL(I),N2(I),YL(I),XR(I):NEXTI
260 DATA8,20,-4,31,8,12,1,27,12,6,5,24,15,2,8,22,17,0,10,21
270 CX=INT(RND(1)*H)+1:CY=INT(RND(1)*V)+1
280 C=CX:R=CY:S=0
290 FORI=0TO(V+1)*H1:POKEW+I,0:POKEV1+I,0:NEXT
300 PRINT"[147]SETTING UP MAZE...";
310 DA=0:N=0:AV=V1+C+R*H1:AW=W+C+R*H1:POKEAW,1:S=S+1:IFS>=H*VTHEN570
320 PRINTMID$("[146]",(SAND1)+1,1);"[214][157]";
330 IFC>1ANDPEEK(AW-1)=0THENDA=DA+2:N=N+1
340 IFC<HANDPEEK(AW+1)=0THENDA=DA+1:N=N+1
350 IFR>1ANDPEEK(AW-H1)=0THENDA=DA+8:N=N+1
360 IF(R<VANDPEEK(AW+H1)=0)THENDA=DA+4:N=N+1
370 N=INT(RND(1)*N)+1
380 ONDA+1GOTO390,560,550,420,540,430,440,450,530,460,470,480,490,500,510,520
390 S=S-1
400 C=C+1:IFC>HTHENC=1:R=R+1:IFR>VTHENR=1
410 ONPEEK(W+C+R*H1)+1GOTO400,310
420 ONNGOTO550,560
430 ONNGOTO540,560
440 ONNGOTO540,550
450 ONNGOTO540,550,560
460 ONNGOTO530,560
470 ONNGOTO530,550
480 ONNGOTO530,550,560
490 ONNGOTO530,540
500 ONNGOTO530,540,560
510 ONNGOTO530,540,550
520 ONNGOTO530,540,550,560
530 R=R-1:AV=AV-H1:POKEAV,PEEK(AV)OR1:GOTO310
540 POKEAV,PEEK(AV)OR1:R=R+1:AV=AV+H1:GOTO310
550 C=C-1:AV=AV-1:POKEAV,PEEK(AV)OR2:GOTO310
560 POKEAV,PEEK(AV)OR2:C=C+1:AV=AV+1:GOTO310
570 I=RND(1)>.5:J=RND(1):K=RND(1)>.5
580 IFITHENX=INT(J*H)+1:Y=V+(V-1)*K
590 IFI=0THENY=INT(J*V)+1:X=H+(H-1)*K
600 IF(CX-X)^2+(CY-Y)^2<(H^2+V^2)/9THEN570
610 SX=X:SY=Y
620 PRINT"[147]
630 [129]I[178]W[164]W[170](V[170]1)[172]H1:[151]I,0:[130]
640 D[178][181]([187](1)[172]4)
650 T4[178]TI:[151](W[170]X[170]Y[172]H1),1
660 [139]F[178]0[167][141]1020:[153]"";[181]([186]((X[171]CX)[174]2[170](Y[171]CY)[174]2)[172]10[170].5)[173]10
670 [139]CX[178]X[175]CY[178]Y[167]2640
680 I[178][194](56320)[175]15
690 [139](([194](56320)[175]16)[178]0)[167]K[178]TI:[137]2660
700 [139]I[178]15[167]680
710 [139]I[178]13[167]D[178]D[170]2
720 [139]I[178]11[167]D[178]D[171]1
730 [139]I[178]7[167]D[178]D[170]1
740 [139]D[179]0[167]D[178]D[170]4
750 [139]D[177]3[167]D[178]D[171]4
760 [139]I[179][177]14[167]660
770 AV[178]V1[170]X[170]Y[172]H1:AW[178]W[170]X[170]Y[172]H1
780 [145]D[137]810,830,850
790 [139]Y[177]1[175]([194](AV[171]H1)[175]1)[167]Y[178]Y[171]1:[151]AW[171]H1,1:[137]660
800 [137]860
810 [139]X[179]H[175]([194](AV)[175]2)[167]X[178]X[170]1:[151]AW[170]1,1:[137]660
820 [137]860
830 [139]Y[179]V[175]([194](AV)[175]1)[167]Y[178]Y[170]1:[151]AW[170]H1,1:[137]660
840 [137]860
850 [139]X[177]1[175]([194](AV[171]1)[175]2)[167]X[178]X[171]1:[151]AW[171]1,1:[137]660
860 DN[178]23:[141]2720
870 [153][163]16);"ANDANDANDANDANDANDANDCMDCMDCMDCMDCMDCMDCMDNO DOORON":[129]I[178]1[164]1000:[130]
880 [153][163]16);"ON CMDCMDCMDCMDCMDCMDCMD ON":[137]670
890 [153]"LOAD ";
900 [129]I[178]1[164]H:[153]"ANDANDAND";:[130]:[153]""
910 [129]J[178]1[164]V:[153]"THENONCMDTHENONCMDTHEN";:[129]I[178]1[164]H
920 K[178][194](V1[170]I[170]J[172]H1)
930 [153][202]("ANDANDSQR THENANDANDAND ",1[170]3[172]K,3);
940 [139]K[179]2[167][153]"ONCMDTHENONCMDTHEN";
950 [153]"ONCMD";
960 [139][194](W[170]I[170]J[172]H1)[178]1[167][153]"CMD.";
970 [139]I[178]SX[175]J[178]SY[167][153]"CMD WAIT";
980 [139]I[178]CX[175]J[178]CY[167][153]"CMDSPC(";
990 [139]I[178]X[175]J[178]Y[167][153]"CMD";[202]("^>V<",D[170]1,1);
1000 [153]"";
1010 [130]:[153]"":[130]:[142]
1020 S[178]0:[153]"LOAD
1030 AV=V1+X+Y*H1
1040 ONDGOTO1190,1330,1470
1050 IFSY=Y-SANDSX=XTHENGOSUB2570
1060 IFCY=Y-SANDCX=XTHENGOSUB2510
1070 K=PEEK(AV-(S+1)*H1):IFK=0ORK=2GOTO1140
1080 IFPEEK(AV-S*H1)AND2THENGOSUB1620:GOTO1100
1090 GOSUB1740
1100 IFPEEK(AV-1-S*H1)AND2THENGOSUB2090:GOTO1120
1110 GOSUB2210
1120 S=S+1:IFS>4GOTO1610
1130 GOTO1050
1140 IFPEEK(AV-S*H1)AND2THENGOSUB1820:GOTO1160
1150 GOSUB2290
1160 IFPEEK(AV-1-S*H1)AND2THENGOSUB1960:GOTO1180
1170 GOSUB2390
1180 RETURN
1190 IFCY=YANDCX=X+STHENGOSUB2510
1200 IFSY=YANDSX=X+STHENGOSUB2570
1210 K=PEEK(AV+S):IFK=0ORK=1GOTO1280
1220 IFPEEK(AV+S)=2THENGOSUB1740:GOTO1240
1230 GOSUB1620
1240 IFPEEK(AV+S-H1)AND1THENGOSUB2090:GOTO1260
1250 GOSUB2210
1260 S=S+1:IFS>4GOTO1610
1270 GOTO1190
1280 IFPEEK(AV+S)=0THENGOSUB2290:GOTO1300
1290 GOSUB1820
1300 IFPEEK(AV+S-H1)AND1THENGOSUB1960:GOTO1320
1310 GOSUB2390
1320 RETURN
1330 IFCY=Y+SANDCX=XTHENGOSUB2510
1340 IFSY=Y+SANDSX=XTHENGOSUB2570
1350 K=PEEK(AV+S*H1):IFK=0ORK=2THENGOTO1420
1360 IFPEEK(AV-1+S*H1)AND2THENGOSUB1620:GOTO1380
1370 GOSUB1740
1380 IFPEEK(AV+S*H1)=1THENGOSUB2210:GOTO1400
1390 GOSUB2090
1400 S=S+1:IFS>4GOTO1610
1410 GOTO1330
1420 IFPEEK(AV-1+S*H1)AND2THENGOSUB1820:GOTO1440
1430 GOSUB2290
1440 IFPEEK(AV+S*H1)=0THENGOSUB2390:GOTO1460
1450 GOSUB1960
1460 RETURN
1470 IFCX=X-SANDCY=YTHENGOSUB2510
1480 IFSX=X-SANDSY=YTHENGOSUB2570
1490 K=PEEK(AV-(S+1)):IFK=0ORK=1THENGOTO1560
1500 IFPEEK(AV-S-H1)AND1THENGOSUB1620:GOTO1520
1510 GOSUB1740
1520 IFPEEK(AV-S)AND1THENGOSUB2090:GOTO1540
1530 GOSUB2210
1540 S=S+1:IFS>4THEN1610
1550 GOTO1470
1560 IFPEEK(AV-S-H1)AND1THENGOSUB1820:GOTO1580
1570 GOSUB2290
1580 IFPEEK(AV-S)AND1THENGOSUB1960:GOTO1600
1590 GOSUB2390
1600 RETURN
1610 DN=11:GOSUB2720:PRINTTAB(19)"[205][206][157][157][206][205]":RETURN
1620 DN=YL(S):GOSUB2720
1630 IFS=0THENPRINTTAB(XR(S));"[175]"
1640 IFS>0ANDS<4THENFORI=1TO4-S:PRINTTAB(XR(S)+5-S)"[165]":NEXT
1650 IFS>0THENPRINTTAB(XR(S))MID$("[175][175][175][175][165]",S)
1660 IFS=4THENPRINTTAB(XR(S))"[165][165][157][157][165][165]"
1670 Q$="":IFS>0THENQ$=MID$("[165]",S)
1680 IFS<4THENFORI=0TON2(S)+1:PRINTTAB(XR(S))"[165]"Q$:NEXT
1690 IFS>0THENPRINTTAB(XR(S))MID$("[183][183][183][183][165]",S)
1700 IFS>0ANDS<4THENFORI=1TO4-S:PRINTTAB(XR(S)+5-S)"[165]":NEXT
1710 IFS=0THENPRINTTAB(XR(S))"[183]"
1720 PRINT"
1730 [142]
1740 DN[178]YL(S):[141]2720
1750 [139]S[178]0[167][153][163]XR(S))"(null)":[137]1770
1760 [129]I[178]1[164]5[171]S:[153][163]XR(S)[170]5[171]S[171]I)"(null)":[130]
1770 DN[178]N2(S)[170]2:[141]2730
1780 [139]S[178]0[167][153][163]XR(S))"(null)":[137]1800
1790 [129]I[178]0[164]4[171]S:[153][163]XR(S)[170]I)"(null)":[130]
1800 [153]"
1810 RETURN
1820 J=3-S:IFS=0THENJ=0
1830 PRINT"";
1840 IFS>0GOTO1880
1850 PRINTTAB(20);:PRINT"";:FORI=1TO18:PRINT"[183]";:NEXT:PRINT"[183]"
1860 DN=N2(0):GOSUB2730
1870 PRINTTAB(20);:FORI=1TO19:PRINT"[175]";:NEXT:GOTO1940
1880 DN=YL(S):GOSUB2730
1890 FORI=1TO5-S:PRINTTAB(J+XR(S)+2)"[165]":NEXT
1900 PRINTTAB(20);:FORI=19TOJ+XR(S):PRINT"[183]";:NEXT:PRINT"[165]"
1910 IFS<4THENFORI=1TON2(S):PRINTTAB(J+XR(S)+2)"[165]":NEXT
1920 PRINTTAB(20);:FORI=19TOJ+XR(S):PRINT"[175]";:NEXT:PRINT"[165]"
1930 FORI=1TO5-S:PRINTTAB(J+XR(S)+2)"[165]":NEXT
1940 PRINT"
1950 [142]
1960 [153]"";
1970 [139]S[177]0[137]2010
1980 [153]"";:[129]I[178]1[164]11[170]XL(0):[153]"USR";:[130]:[153]"USR"
1990 DN[178]N2(0):[141]2730
2000 [129]I[178]1[164]12[170]XL(0):[153]"AND";:[130]:[137]1940
2010 DN[178]YL(S):[141]2730
2020 [129]I[178]1[164]5[171]S:[153][163]XL(S))"THEN":[130]
2030 [153][163]XL(S));:[153]"THEN";:[129]I[178]XL(S)[164]17:[153]"USR";:[130]:[153]"USR"
2040 [139]S[179]4[167][129]I[178]1[164]N2(S):[153][163]XL(S))"THEN":[130]
2050 [153][163]XL(S));:[153]"THEN";:[129]I[178]XL(S)[164]17:[153]"AND";:[130]:[153]"AND"
2060 [129]I[178]1[164]5[171]S:[153][163]XL(S))"THEN":[130]
2070 [153]"
2080 RETURN
2090 DN=YL(S):GOSUB2720
2100 IFS=0THENPRINTTAB(XL(S));"[175]"
2110 IFS>0ANDS<4THENFORI=1TO4-S:PRINTTAB(XL(S))"[167]":NEXT
2120 IFS>0THENPRINTTAB(XL(S))LEFT$("[167][175][175][175][175]",6-S)
2130 IFS=4THENPRINTTAB(XL(S))"[167][167][157][157][167][167]"
2140 Q$="":IFS>0THENQ$=MID$("[167]",S)
2150 IFS<4THENFORI=0TON2(S)+1:PRINTTAB(XL(S))"[167]"Q$:NEXT
2160 IFS>0THENPRINTTAB(XL(S))LEFT$("[167][183][183][183][183]",6-S)
2170 IFS>0ANDS<4THENFORI=1TO4-S:PRINTTAB(XL(S))"[167]":NEXT
2180 IFS=0THENPRINTTAB(XL(S))"[183]"
2190 PRINT"
2200 [142]
2210 DN[178]YL(S):[141]2720
2220 [139]S[178]0[167][153][163]XL(S));"(null)":[137]2240
2230 [129]I[178]1[164]5[171]S:[153][163]XL(S)[170]I)"(null)":[130]
2240 DN[178]N2(S)[170]2:[141]2730
2250 [139]S[178]0[167][153][163]XL(S))"(null)":[137]2270
2260 [129]I[178]0[164]4[171]S:[153][163]XL(S)[170]5[171]S[171]I)"(null)":[130]
2270 [153]""
2280 [142]
2290 [141]1740
2300 DN[178]YL(S)[170]5[171]S:[141]2720
2310 [153][163]20);
2320 [139]S[179]4[167][129]I[178]1[164]XR(S)[171]21:[153]"USR";:[130]
2330 [153]"(null)CMD";
2340 [139]S[179]4[167][129]I[178]1[164]N2(S):[153]"THENCMD";:[130]
2350 [153]"SQRCMDCMD";
2360 [139]S[179]4[167][129]I[178]1[164]XR(S)[171]20[171]1:[153]"ANDCMDCMD";:[130]
2370 [153]"
2380 RETURN
2390 IFS=0THENJ=5:GOTO2410
2400 J=0
2410 GOSUB2210
2420 DN=YL(S)+5-S:GOSUB2720
2430 PRINTTAB(19);
2440 IFS<4THENFORI=1TO18-XL(S)-5+S+J:PRINT"[183][157][157]";:NEXT
2450 PRINT"[207][157]";
2460 IFS<4THENFORI=1TON2(S):PRINT"[165][157]";:NEXT
2470 PRINT"[204]";
2480 IFS<4THENFORI=1TO18-XL(S)-5+S+J:PRINT"[175]";:NEXT
2490 PRINT"
2500 [142]
2510 [139]S[178]0[176]S[178]4[167][142]
2520 DN[178]18:[141]2720
2530 [139]S[178]3[167][153][163]20);"ONONON.
2540 IFS=2THENPRINTTAB(19);"[145][169][146][169][157][157][166][206][145][165]
2550 [139]S[178]1[167][153][163]18);" ANDANDANDCMDCMDCMDCMD(null) (null)FNCMDCMDCMDCMDCMDSPC(SPC(SPC( FNCMDCMDCMDCMDCMDSPC(SPC(SPC((null)
2560 RETURN
2570 IFS=0ORS=4THENRETURN
2580 DN=20:GOSUB2720
2590 IFS=3THENPRINTTAB(19);"[145][145][145][145][145][162][162][145][157][157][146][162][162]
2600 [139]S[178]2[167][153][163]16);"ONONONSTEP (null)
2610 IFS=1THENPRINTTAB(13);"[169] [223]
2620 [139]S[178]1[167][153][163]12);"STEP (null)
2630 RETURN
2640 K=TI:FORI=1TO25:PRINT:PRINT""TAB(15)"DELICIOUS!":FORJ=1TO50:NEXTJ
2650 PRINT:PRINT""TAB(15)" ":FORJ=1TO50:NEXTJ,I
2660 GOSUB890
2670 PRINT"[145]ANOTHER MAZE? (UP[146] FOR YES DOWN[146] FOR NO)"
2680 I=PEEK(56320)AND15
2690 IFI=14THENPRINT"YES":GOTO270
2700 IFI=13THENPRINT"NO":POKEQK,0:END
2710 GOTO2680
2720 PRINT"";
2730 IFDN>0THENFORZ=1TODN:PRINT"";:NEXT
2740 RETURN